#!/usr/bin/ruby
#coding:utf-8
#意想大富翁

#load File.dirname(__FILE__) + '/ctxt/ct.rb'

require 'thread'
require 'drb/drb'

load 'comm.rb'
load 'poker.rb'
load 'stock.rb'
load 'game.rb'
load 'pt.rb'
load 'player.rb'

load 'test/test_stock.rb'

=begin
`reset`
g=Game.new
#g.market.stocks[0].cards = ["黑桃-1"]
g.play
=end

`reset`

puts("ft_rich SVR started (#{Time.now}) , waiting for players...")
puts("press ctrl+\\ to restart ft_rich SVR")
trap("QUIT") do 
	puts("restarting ft_rich SVR...")
	sleep 1
	exec %[./main.rb]
end

t = Thread.current
t[:w] = STDOUT
t[:r] = STDIN

cards_0 = ["黑桃-5","红桃-5","黑桃-3","方块-5"]

cards_1 = ["黑桃-5","红桃-5"]

cards_2 = ["黑桃-1","红桃-10","方块-10","梅花-2","黑桃-K","黑桃-J"]

cards_3 = ["小鬼"]

game= Game.new
#test_cards_order(game,cards_2)
DRb.start_service($uri,game)
DRb.thread.join
